package log
{
	/**
	 * 倒时计时静态类
	 *  CountDown.returnTime(new Date(2013,4,7,18,0,0)) 返回一个包含天，时，分，秒 4个值的数组。
	 * 可用数组接收函数值。
	 * _msg:String = String(infArr[0] + " 天 " + infArr[1] + ":" + infArr[2] + ":" + infArr[3]);
	 * 输出： 0 天 xx:xx:xx ;
	 */
	public class CountDown
	{
		public function CountDown()
		{
			trace("CountDonw is Static Function ..");
		}
		
		/**
		 * 
		 * @param        newDate
		 * @return
		 */
		public static function returnTime(newDate:Date):Array
		{
			var infArr:Array = new Array();
			var nd:Date = newDate;
			var dt:Date = new Date();
			//trace(dt);                        
			var tm:Number = (Number(nd) - Number(dt)) / 1000 / 60 / 60;
			//trace("tm:" + tm);                        
			var day:int = int(tm) / 24;
			//trace("day:" + day);
			//trace("---------------------: "+int(tm));
			var hour:int = (int(tm) - int(day * 24));
			//trace("hour:" + hour);                        
			var mm:Number = tm - int(tm);
			//trace("mm:" + mm);                        
			var sm:Number = mm * 60 - int(mm * 60);
			//trace("sm:" + sm);
			infArr.push(day);
			infArr.push(hour);
			infArr.push(int(mm * 60));
			infArr.push(int(sm * 60));
			
			//var _msg:String = String(infArr[0] + " 天 " + infArr[1] + ":" + infArr[2] + ":" + infArr[3]);
			//var _msgEn:String = String(infArr[0] + " Day " + infArr[1] + ":" + infArr[2] + ":" + infArr[3]);
			
			//trace("还剩时间是：" + _msg);
			//trace("Spare time：" + _msgEn);                                
			return infArr;
		}
	}
}